Repository navigation
fix(aggregator): derive restore cancellation through restore chains - #4321
Merged
Merged
Conversation
…4310) cancelledActionIds() counted every non-superseded, non-rejected restore target, so when a later restore cancelled an earlier restore, the earlier restore still cancelled its own target: dismiss D -> restore R1 -> restore R2 left D cancelled and the card unsuppressed after undo-of-undo. Derive newest first (input is oldest first): a restore cancels its target only if it is not itself in the cancelled set, so chains of any depth alternate correctly in one pass. Adds depth-2 (applied+new and new+applied) and depth-3 regression tests beside the #1474 rejected-restore controls.
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 48 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #4310 (queue task 6185).
Problem
cancelledActionIds()inpm-stack/aggregator/src/card-state.tscounted the target of every non-superseded, non-rejected restore. In a chain — applied dismiss D, applied restore R1 superseding D, new restore R2 superseding R1 — R1 is itself cancelled by R2 yet still cancelled D, so the undo-of-undo left the card unsuppressed (effective=[R2], suppressed=null) instead of reviving the dismissal.Fix
Derive newest first (the action list is oldest first): a restore cancels its target only when the restore is not itself already in the cancelled set. Each restore's own cancellation is therefore known before its target is considered, and chains of any depth alternate correctly in a single pass. Scoped to card-state derivation only — no ActionsStore supersede or validateNewAction changes.
Tests
test/dashboard-overhaul.test.ts: depth-2 with applied R1 + new R2, depth-2 with new R1 + applied R2, and depth-3 (third restore re-cancels the dismissal), assertingcancelledActionIds,effectiveActions, andcardState().suppressed. All 3 fail on main, pass with the fix.bun test test/dashboard-overhaul.test.ts: 29/29 pass, including the aggregator: a REJECTED restore still cancels its target in card-state — dismissed/snoozed cards resurface even though the consumer refused the restore #1474 rejected-restore controls.test/alerts.test.tsfailing to load (Cannot find package 'web-push') in the fresh worktree — verified identical on clean main (pre-existing environment issue, unrelated to this change).Need help on this PR? Tag
@codesmith-botwith what you need.